<?php


namespace app\common\model;


use app\lib\exception\MysqlErrorException;
use think\Exception;
use think\Model;

class Registered extends Model
{
    # 根据手机号码更新的数据
    public function updatePhoneInfo($phone, $type, $data)
    {
        try{
            self::where('type', '=', $type)
                ->where('phone', '=', $phone)
                ->update($data);
        }catch (Exception $e){
            $data_error = [
                'error_data' => '更新手机号码转态失败',
            ];
            Error::addErrorLog($data_error);
            return [
                'msg' => '更新出错',
                'code' => 400
            ];
        }
    }
    # 根据name和标识获取对应的记录
    public function getSignData($name, $sign)
    {
        return self::where('from', '=', $name)
            ->where('sign', '=', $sign)
            ->select()
            ->toArray();
    }


}